package com.ctvit.sjk.knowledge.document.pojo.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 文档分割VO
 *
 * @author heyingcheng
 * @date 2025/03/25
 */
@Getter
@Setter
@ToString
public class DocumentSplitVO {

    private String name;

    @JsonProperty("content")
    private List<DocumentSplit> documentSplitList;

    public DocumentSplitVO(String name) {
        this.name = name;
        this.documentSplitList = new ArrayList<>(10);
    }

    @Getter
    @Setter
    @ToString
    public static class DocumentSplit {

        private String name;

        private String content;

        public DocumentSplit(String name, String content) {
            this.name = name;
            this.content = content;
        }

    }

    public void addDocumentSplit(String content) {
        addDocumentSplit(StringUtils.EMPTY, content);
    }

    public void addDocumentSplit(String name, String content) {
        this.documentSplitList.add(new DocumentSplit(name, content));
    }

}
